D:\git\skunkworks\herald-for-cpp\herald\include\herald\datatype\proximity.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2020-2021 Herald Project Contributors |
2 | | // SPDX-License-Identifier: Apache-2.0 |
3 | | // |
4 | | |
5 | | #ifndef HERALD_PROXIMITY_H |
6 | | #define HERALD_PROXIMITY_H |
7 | | |
8 | | #include <string> |
9 | | |
10 | | namespace herald { |
11 | | namespace datatype { |
12 | | |
13 | | enum class ProximityMeasurementUnit : short { |
14 | | RSSI, RTT |
15 | | }; |
16 | | |
17 | | struct Proximity { |
18 | | ProximityMeasurementUnit unit; |
19 | | double value; |
20 | | |
21 | 0 | std::string description() const noexcept { |
22 | 0 | return std::to_string((short)unit) + ":" + std::to_string(value); |
23 | 0 | } |
24 | | |
25 | 0 | operator std::string() const noexcept { |
26 | 0 | return description(); |
27 | 0 | } |
28 | | }; |
29 | | |
30 | | |
31 | | } // end namespace |
32 | | } // end namespace |
33 | | |
34 | | #endif |